<!--{eval $_TPL['titles'] = array('编辑作品');}-->
<!--{template header_tpl}-->
<div class="grid_16 main_box">
		<!--{if $work}-->
			<div class="grid_16 box"><h1>修改我的作品</h1>
				<form action="{SITEURL}work/edit/{$work[wid]}" method="post" accept-charset="utf-8" enctype="multipart/form-data" id="workform">
					<table class="formtable">
						<tr>
							<th>
								作品效果图（封面）<br/>
								审核之后封面无法修改。
							</th>
							<td colspan="2">
								<div class="workitem">
									<div class="work_thumb">
										<img src="{$work[thumbimg]}">
									</div>
								</div>
								<!--{if $workpic}-->
										<!--{loop $workpic $value}-->
										<div class="workitem">
											<div class="work_thumb">
												<img src="{$value[thumbimg]}">
											</div>
										</div>
										<!--{/loop}-->

								<!--{/if}-->
							</td>
						</tr>
						<tr>
							<th style="width:15%;">作品标题</th>
							<td><input id="title" type="text" value="{$work[title]}" name="title" class="textinput"></td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<th>作品描述</th>
							<td>
								<textarea name="description" class="areainput" id="description">{$work[description]}
									</textarea>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<th>期待价格(元)</th><td><input id="expectprice" type="text" value="{$work[expectprice]}" name="expectprice" class="textinput"></td>
							<td>&nbsp;</td>
						</tr>
						<!--{if $workfield[design]}-->
						<tr>
							<th>下载设计图</th>
							<td><a href="{SITEURL}upload/designdrawings/{$workfield[design]}">点此下载</a></td>
							<td>&nbsp;</td>
						</tr>
						<!--{/if}-->
						<tr>
							<th>上传设计图(3M以下)</th><td><input type="file" name="design" value="" id="design" class="textinput"></td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<th>标签</th><td>
								<input id="tag" type="text" value="{$work[tags]}" name="tag" class="textinput">
								<input class="button" type="button" onclick="relatekw();" value="自动获取" name="clickbutton[]">
								</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td colspan="2"><input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
							<input type="submit" name="worksubmit" value="修改" id="worksubmit"></td>
						</tr>
					</table>
				</form>
			</div>
		<!--{else}-->
			<div class="grid_16 box">
				<h1>错误</h1>
			</div>
		<!--{/if}-->

</div>
<div class="grid_7 omega sidebar">
	<!--{template userinfo_tpl}-->
</div>

<script src="<!--{eval echo base_url();}-->resources/js/jquery.validate.min.js" type="text/javascript"></script>
<script src="<!--{eval echo base_url();}-->resources/js/validate.messages_cn.js" type="text/javascript"></script>
<script src="<!--{eval echo base_url();}-->resources/js/validate.additional-methods.min.js" type="text/javascript"></script>
<script src="<!--{eval echo base_url();}-->resources/js/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
	var validator = $("#workform").validate({
		onfocusout:false,
		errorElement:"span",
		rules: {
			title: {
				required: true,
				rangelength:[1,100] 
			},
			description: {
				required: true,
				rangelength:[1,50000]
			},
			expectprice: {
				required: true,
				number: true,
				rangelength:[1,6] 
			},
			tag:{
		      required: function(element) {
				if ($('#tag').val() == '') {
					relatekw();
				}
				return true;
		      }
			}
		},
		messages: {
			title: {
				required: "请输标题",
				rangelength: $.validator.format("标题长度 为{0} 到 {1} 汉字")
			},
			description: {
				required: "请输入作品描述",
				rangelength: $.validator.format("长度 为{0} 到 {1} 汉字")
			},
			expectprice: {
				required: "请输入期待价格",
				rangelength: $.validator.format(" 为{0} 到 {1} 位")
			},
			tag:{
				required:'填写点标签吧'
			}
		},
		errorPlacement: function(error, element) {
			error.appendTo(element.parent("td").next("td"));
		},
		highlight: function(element, errorClass) {
				$(element).fadeOut(function() {
				$(element).fadeIn();
			});
		},
		success: function(label) {
		}
	});
});
</script>
<!--{template footer_tpl}-->